# -*- coding=utf-8 -*-

def Manacher(s):
    s = '#'+'#'.join(s)+'#'
    p = [1]*len(s)
    ml = 0
    x = 0
    u = 0
    for i in range(len(s)):
        if i<u :
            p[i] = min(p[2*x-i],u-i)
        while i-p[i]>=0 and i+p[i]<len(s) and s[i+p[i]]==s[i-p[i]] :
            p[i] += 1
        if i+p[i]>u :
            u = i+p[i]-1
            x = i
        ml = max(ml,p[i])
    return ml-1

def manacher(s):
    ss = '#'+'#'.join(s)+'#'
    print ss
    p,ml,x,u = [0]*len(ss),0,0,0
    for i in xrange(len(ss)):
        p[i] = min(p[2*x-i],u-i) if i<u else p[i]
        while i-p[i]>=0 and i+p[i]<len(ss) and ss[i-p[i]]==ss[i+p[i]]:
            p[i] += 1
        u,x = (i+p[i]-1,i) if i+p[i]>u else (u,x)
        ml = max(p[i],ml)
    return ml-1

def main() :
    s = raw_input()
    print manacher(s)

if __name__ == '__main__' :
    main()
